package lib.wman.org.mvp.demo;

import android.content.Intent;
import android.view.View;

import lib.wman.org.mvp.R;
import lib.wman.org.mvp.databind.DataBindActivity;
import lib.wman.org.mvp.databind.DataBinder;

//public class SettingActivity extends BaseBackActivity<SettingDelegate> {
public class SettingActivity extends DataBindActivity<SettingDelegate> {

    JavaBean data = new JavaBean("名字");

    @Override
    protected void bindEventListener() {
        //模拟数据改变(比如也可以写在网络请求成功的时候改变数据)
        mViewDelegate.get(R.id.button1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                data.setName("wman");
                //通知数据发生了改变
                notifyModelChanged(data);
            }
        });
        mViewDelegate.get(R.id.button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(SettingActivity.this, BackActivity.class));
            }
        });
    }

    @Override
    protected Class getDelegateClass() {
        return SettingDelegate.class;
    }

    @Override
    public DataBinder getDataBinder() {
        return new SettingDataBinder();
    }
}
